#ifndef HEARTBEATMANAGER_H
#define HEARTBEATMANAGER_H

#include <iostream>
#include "Epoll_Network/include/TcpServer.h"
#include <MsgHandler/include/JsonEncoder.h>
#include <list>
#include <mutex>
#include <chrono>
struct SocketBlock{
    int socket;
    std::chrono::high_resolution_clock::time_point start_time;
};

class HeartBeatManager
{
public:
    static HeartBeatManager* getInstance();
    void addSocket(int socket);
    void removeSocket(int socket);

private:

    HeartBeatManager(){}
    void workFunc(const HeartBeatManager* obj);
    static HeartBeatManager instance;

    std::list<SocketBlock> socket_list;

    std::mutex mtx;
};

#endif // HEARTBEATMANAGER_H
